package com.java2001.utils;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.SimpleHash;

public class Encryptor {

    public static String[] getNewPassword(String source){
        //随机生成salt值，并通过用户注册的密码和salt值经两次md5算法生成真实存储的密
        String salt = new SecureRandomNumberGenerator().nextBytes().toString();
        String[] arr = new String[2];
        arr[0] = salt;
        arr[1] = new SimpleHash("md5", source, salt, 2).toString();
        return arr;
    }
}
